package gw.com.android.utils;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import gw.com.android.app.ActivityManager;
import gw.com.android.app.AppContances;
import gw.com.android.model.ConfigType;
import gw.com.android.ui.bulletin.NotifyCentreActivity;
import gw.com.android.ui.onlive.AutoDiscussActivity;
import gw.com.android.ui.onlive.TradeResultData;
import gw.com.android.ui.quote2.QuoteChartConfig;
import gw.com.android.ui.record.RecordActivity;
import gw.com.android.ui.trade.OrderCreateActivity;
import www.com.library.model.DataItemDetail;

/**
 * @author jett
 * @since 2018-05-30.
 */
public class AppTest {

    public void openOrder_old(Activity activity) {
        Intent intent = new Intent(activity, OrderCreateActivity.class);
        Bundle bundle = new Bundle();
        bundle.putInt("uiCode", QuoteChartConfig.LONDON_GOLD);
        bundle.putInt("orderDir", AppContances.TRADE_TYPE_BUY);
        intent.putExtra("params", bundle);
        activity.startActivityForResult(intent, AppContances.REQUEST_TRADE_CODE);
    }

    public void autoDiscuss(Activity context) {
        TradeResultData data = new TradeResultData();
        data.profit = false;
        data.amount = "4.89";
        data.product = "丝袜";
        data.quantity = "0.88";
        data.openPrice = "2.2222";
        data.closePrice = "1.1111";
        data.openTime = "2018-03-09 66:66:66";
        data.closeTime = "2018-03-09 88:88:88";
        context.startActivityForResult(new Intent(context, AutoDiscussActivity.class).putExtra("tradeResult", data), 33);
    }

    public void openChartActivity(Activity activity) {
        ActivityManager.showChartActivity(activity, QuoteChartConfig.LONDON_GOLD, 0, 0);
    }

    public void openNoticeCentre(Activity activity) {
        Intent intent = new Intent(activity, NotifyCentreActivity.class);
        activity.startActivity(intent);
    }

    public void appInterface(Activity activity) {
        DataItemDetail detail = new DataItemDetail();
        detail.setStringValue(ConfigType.CONFIG_TYPE_TYPE_URL_TAG, "hxgts2://trade/create_order?code=3289904");
        ActivityManager.showWebPageActivity(activity, detail, null);
    }

    public void record(Activity activity) {
        Intent intent = new Intent(activity, RecordActivity.class);
        activity.startActivity(intent);
    }

}
